package uia.alumni.data;

import java.sql.Date;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Column;



/**
 *
 * @author Even Åby Larsen (even.larsen@uia.no)
 */
@Entity @Table(name="is202_alumni_cventry")
@NamedQuery(name="CvEntry.byUserDescending",
        query="SELECT cve FROM CvEntry cve WHERE cve.user = :user ORDER BY cve.fromDate")
public class CvEntry {
    @Id @GeneratedValue
    @Column(name="cve_id")
    private long id;

    @ManyToOne
    private User user;

    private String type;

    private String description;

    @Column(name="from_date")
    private Date fromDate;

    @Column(name="to_date")
    private Date toDate;

    public final static long serialVersionUID = 1;


    /** Entities must have default constructor */
    public CvEntry() {
        // nothing to do
    }

    public CvEntry(String type, String description, Date fromDate, Date toDate) {
        this.type = type;
        this.description = description;
        this.fromDate = fromDate;
        this.toDate = toDate;
    }

    public long getId() {
        return id;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getFromDate() {
        return fromDate;
    }

    public void setFromDate(Date fromDate) {
        this.fromDate = fromDate;
    }

    public Date getToDate() {
        return toDate;
    }

    public void setToDate(Date toDate) {
        this.toDate = toDate;
    }    
}
